#include "WindbgExt.h"
#include <stdexcept>

#ifndef IMAGE_FILE_MACHINE_ARMNT
//#error needed to set valid value for IMAGE_FILE_MACHINE_ARMNT
#define IMAGE_FILE_MACHINE_ARMNT 0xffff
#endif

#include "../windbg/inc/engextcpp.hpp"

class WindbgExtImpl: public WindbgExt
{
public:
	WindbgExtImpl() {}

	virtual IDebugAdvanced* ExtAdvanced()
	{
		return m_ext->m_Advanced;
	}

	virtual IDebugClient* ExtClient()
	{
		return m_ext->m_Client;
	}

	virtual IDebugControl* ExtControl()
	{
		return m_ext->m_Control;
	}

	virtual IDebugDataSpaces* ExtData()
	{
		return m_ext->m_Data;
	}

	virtual IDebugRegisters* ExtRegisters()
	{
		return m_ext->m_Registers;
	}

	virtual IDebugSymbols* ExtSymbols()
	{
		return m_ext->m_Symbols;
	}

	virtual IDebugSystemObjects* ExtSystem()
	{
		return m_ext->m_System;
	}

	virtual IDebugAdvanced2* ExtAdvanced2() throw(...)
	{
		return m_ext->m_Advanced2;
	}

	virtual IDebugAdvanced3* ExtAdvanced3() throw(...)
	{
		return m_ext->m_Advanced3;
	}

	virtual IDebugClient2* ExtClient2() throw(...)
	{
		return m_ext->m_Client2;
	}

	virtual IDebugClient3* ExtClient3() throw(...)
	{
		return m_ext->m_Client3;
	}

	virtual IDebugClient4* ExtClient4() throw(...)
	{
		return m_ext->m_Client4;
	}

	virtual IDebugClient5* ExtClient5() throw(...)
	{
		return m_ext->m_Client5;
	}

	virtual IDebugControl2* ExtControl2() throw(...)
	{
		return m_ext->m_Control2;
	}

	virtual IDebugControl3* ExtControl3() throw(...)
	{
		return m_ext->m_Control3;
	}

	virtual IDebugControl4* ExtControl4() throw(...)
	{
		return m_ext->m_Control4;
	}

	virtual IDebugControl5* ExtControl5() throw(...)
	{
		return m_ext->m_Control5;
	}

	virtual IDebugControl6* ExtControl6() throw(...)
	{
		return m_ext->m_Control6;
	}

	virtual IDebugDataSpaces2* ExtData2() throw(...)
	{
		return m_ext->m_Data2;
	}

	virtual IDebugDataSpaces3* ExtData3() throw(...)
	{
		return m_ext->m_Data3;
	}

	virtual IDebugDataSpaces4* ExtData4() throw(...)
	{
		return m_ext->m_Data4;
	}

	virtual IDebugRegisters2* ExtRegisters2() throw(...)
	{
		return m_ext->m_Registers2;
	}

	virtual IDebugSymbols2* ExtSymbols2() throw(...)
	{
		return m_ext->m_Symbols2;
	}

	virtual IDebugSymbols3* ExtSymbols3() throw(...)
	{
		return m_ext->m_Symbols3;
	}

	virtual IDebugSystemObjects2* ExtSystem2() throw(...)
	{
		return m_ext->m_System2;
	}

	virtual IDebugSystemObjects3* ExtSystem3() throw(...)
	{
		return m_ext->m_System3;
	}

	virtual IDebugSystemObjects4* ExtSystem4() throw(...)
	{
		return m_ext->m_System4;
	}

	virtual void* ExtDummy1() throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void* ExtDummy2() throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void* ExtDummy3() throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void* ExtDummy4() throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void* ExtDummy5() throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void* ExtDummy6() throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void* ExtDummy7() throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void* ExtDummy8() throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void* ExtDummy9() throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual ULONG Get_OutputWidth()
	{
		return m_ext->m_OutputWidth;
	}

	virtual ULONG Get_ActualMachine()
	{
		return m_ext->m_ActualMachine;
	}

	virtual ULONG Get_Machine()
	{
		return m_ext->m_Machine;
	}

	virtual ULONG Get_PageSize()
	{
		return m_ext->m_PageSize;
	}

	virtual ULONG Get_PtrSize()
	{
		return m_ext->m_PtrSize;
	}

	virtual ULONG Get_NumProcessors()
	{
		return m_ext->m_NumProcessors;
	}

	virtual ULONG64 Get_OffsetMask()
	{
		return m_ext->m_OffsetMask;
	}

	virtual ULONG Get_DebuggeeClass()
	{
		return m_ext->m_DebuggeeClass;
	}

	virtual ULONG Get_DebuggeeQual()
	{
		return m_ext->m_DebuggeeQual;
	}

	virtual ULONG Get_DumpFormatFlags()
	{
		return m_ext->m_DumpFormatFlags;
	}

	virtual bool Get_IsRemote()
	{
		return m_ext->m_IsRemote;
	}

	virtual bool Get_OutCallbacksDmlAware()
	{
		return m_ext->m_OutCallbacksDmlAware;
	}

	virtual bool IsUserMode(void)
	{
		return m_ext->IsUserMode();
	}

	virtual bool IsKernelMode(void)
	{
		return m_ext->IsKernelMode();
	}

	virtual bool IsLiveLocalUser(void)
	{
		return m_ext->IsLiveLocalUser();
	}

	virtual bool IsMachine32(ULONG Machine)
	{
		return m_ext->IsMachine32(Machine);
	}

	virtual bool IsCurMachine32(void)
	{
		return m_ext->IsCurMachine32();
	}

	virtual bool IsMachine64(ULONG Machine)
	{
		return m_ext->IsMachine64(Machine);
	}

	virtual bool IsCurMachine64(void)
	{
		return m_ext->IsCurMachine64();
	}

	virtual bool Is32On64(void)
	{
		return m_ext->Is32On64();
	}

	virtual bool CanQueryVirtual(void)
	{
		return m_ext->CanQueryVirtual();
	}

	virtual bool HasFullMemBasic(void)
	{
		return m_ext->HasFullMemBasic();
	}

	virtual bool IsExtensionRemote(void)
	{
		return m_ext->IsExtensionRemote();
	}

	virtual bool AreOutputCallbacksDmlAware(void)
	{
		return m_ext->AreOutputCallbacksDmlAware();
	}

	virtual void RequireUserMode(void)
	{
		return m_ext->RequireUserMode();
	}

	virtual void RequireKernelMode(void)
	{
		return m_ext->RequireKernelMode();
	}

	virtual ULONG& Get_OutMask()
	{
		return m_ext->m_OutMask;
	}

	virtual void Out(PCSTR Format, ...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void Out(PCWSTR Format, ...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void Warn(PCSTR Format, ...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void Warn(PCWSTR Format, ...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void Err(PCSTR Format, ...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void Err(PCWSTR Format, ...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void Verb(PCSTR Format, ...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void Verb(PCWSTR Format, ...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void Dml(PCSTR Format, ...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void Dml(PCWSTR Format, ...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void DmlWarn(PCSTR Format, ...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void DmlWarn(PCWSTR Format, ...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void DmlErr(PCSTR Format, ...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void DmlErr(PCWSTR Format, ...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void DmlVerb(PCSTR Format, ...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void DmlVerb(PCWSTR Format, ...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void DmlCmdLink(PCSTR Text, PCSTR Cmd)
	{
		return m_ext->DmlCmdLink(Text, Cmd);
	}

	virtual void DmlCmdExec(PCSTR Text, PCSTR Cmd)
	{
		return m_ext->DmlCmdExec(Text, Cmd);
	}

	virtual void RefreshOutputCallbackFlags(void)
	{
		return m_ext->RefreshOutputCallbackFlags();
	}

	virtual ULONG& Get_CurChar()
	{
		return m_ext->m_CurChar;
	}

	virtual ULONG& Get_LeftIndent()
	{
		return m_ext->m_LeftIndent;
	}

	virtual bool Get_AllowWrap()
	{
		return m_ext->m_AllowWrap;
	}

	virtual bool Get_TestWrap()
	{
		return m_ext->m_TestWrap;
	}

	virtual ULONG Get_TestWrapChars()
	{
		return m_ext->m_TestWrapChars;
	}

	virtual void WrapLine(void)
	{
		return m_ext->WrapLine();
	}

	virtual void OutWrapStr(__in PCSTR String)
	{
		return m_ext->OutWrapStr(String);
	}

	virtual void WINAPIV OutWrap(__in PCSTR Format, ...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual bool DemandWrap(__in ULONG Chars)
	{
		return m_ext->DemandWrap(Chars);
	}

	virtual void AllowWrap(__in bool Allow)
	{
		return m_ext->AllowWrap(Allow);
	}

	virtual void TestWrap(__in bool Test)
	{
		return m_ext->TestWrap(Test);
	}

	virtual PSTR RequestCircleString(__in ULONG Chars) throw(...)
	{
		return m_ext->RequestCircleString(Chars);
	}

	virtual PSTR CopyCircleString(__in PCSTR Str) throw(...)
	{
		return m_ext->CopyCircleString(Str);
	}

	virtual PSTR WINAPIV PrintCircleString(__in PCSTR Format, ...) throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual PSTR Get_AppendBuffer()
	{
		return m_ext->m_AppendBuffer;
	}

	virtual ULONG Get_AppendBufferChars()
	{
		return m_ext->m_AppendBufferChars;
	}

	virtual PSTR Get_AppendAt()
	{
		return m_ext->m_AppendAt;
	}

	virtual void SetAppendBuffer(__in_ecount(BufferChars) PSTR Buffer, __in ULONG BufferChars)
	{
		return m_ext->SetAppendBuffer(Buffer, BufferChars);
	}

	virtual void AppendBufferString(__in PCSTR Str) throw(...)
	{
		return m_ext->AppendBufferString(Str);
	}

	virtual void WINAPIV AppendString(__in PCSTR Format, ...) throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual bool IsAppendStart(void)
	{
		return m_ext->IsAppendStart();
	}

	virtual void SetCallStatus(__in HRESULT Status)
	{
		return m_ext->SetCallStatus(Status);
	}

	virtual ULONG GetCachedSymbolTypeId(__inout PULONG64 Cookie, __in PCSTR Symbol, __out PULONG64 ModBase)
	{
		return m_ext->GetCachedSymbolTypeId(Cookie, Symbol, ModBase);
	}

	virtual ULONG GetCachedFieldOffset(__inout PULONG64 Cookie, __in PCSTR Type, __in PCSTR Field, __out_opt PULONG64 ModBase = NULL, __out_opt PULONG TypeId = NULL)
	{
		return m_ext->GetCachedFieldOffset(Cookie, Type, Field, ModBase, TypeId);
	}

	virtual bool GetCachedSymbolInfo(__in ULONG64 Cookie, __out PDEBUG_CACHED_SYMBOL_INFO Info)
	{
		return m_ext->GetCachedSymbolInfo(Cookie, Info);
	}

	virtual bool AddCachedSymbolInfo(__in PDEBUG_CACHED_SYMBOL_INFO Info, __in bool ThrowFailure, __out PULONG64 Cookie)
	{
		return m_ext->AddCachedSymbolInfo(Info, ThrowFailure, Cookie);
	}

	virtual void GetModuleImagehlpInfo(__in ULONG64 ModBase, __out struct _IMAGEHLP_MODULEW64* Info)
	{
		return m_ext->GetModuleImagehlpInfo(ModBase, Info);
	}

	virtual bool ModuleHasGlobalSymbols(__in ULONG64 ModBase)
	{
		return m_ext->ModuleHasGlobalSymbols(ModBase);
	}

	virtual bool ModuleHasTypeInfo(__in ULONG64 ModBase)
	{
		return m_ext->ModuleHasTypeInfo(ModBase);
	}

	virtual ULONG GetNumUnnamedArgs(void)
	{
		return m_ext->GetNumUnnamedArgs();
	}

	virtual PCSTR GetUnnamedArgStr(__in ULONG Index) throw(...)
	{
		return m_ext->GetUnnamedArgStr(Index);
	}

	virtual ULONG64 GetUnnamedArgU64(__in ULONG Index) throw(...)
	{
		return m_ext->GetUnnamedArgU64(Index);
	}

	virtual bool HasUnnamedArg(__in ULONG Index)
	{
		return m_ext->HasUnnamedArg(Index);
	}

	virtual PCSTR GetArgStr(__in PCSTR Name, __in bool Required = true) throw(...)
	{
		return m_ext->GetArgStr(Name, Required);
	}

	virtual ULONG64 GetArgU64(__in PCSTR Name, __in bool Required = true) throw(...)
	{
		return m_ext->GetArgU64(Name, Required);
	}

	virtual bool HasArg(__in PCSTR Name)
	{
		return m_ext->HasArg(Name);
	}

	virtual bool HasCharArg(__in CHAR Name)
	{
		return m_ext->HasCharArg(Name);
	}

	virtual bool SetUnnamedArg(__in ULONG Index, __in_opt PCSTR StrArg, __in ULONG64 NumArg, __in bool OnlyIfUnset = false) throw(...)
	{
		return m_ext->SetUnnamedArg(Index, StrArg, NumArg, OnlyIfUnset);
	}

	virtual bool SetUnnamedArgStr(__in ULONG Index, __in PCSTR Arg, __in bool OnlyIfUnset = false) throw(...)
	{
		return m_ext->SetUnnamedArgStr(Index, Arg, OnlyIfUnset);
	}

	virtual bool SetUnnamedArgU64(__in ULONG Index, __in ULONG64 Arg, __in bool OnlyIfUnset = false) throw(...)
	{
		return m_ext->SetUnnamedArgU64(Index, Arg, OnlyIfUnset);
	}

	virtual bool SetArg(__in PCSTR Name, __in_opt PCSTR StrArg, __in ULONG64 NumArg, __in bool OnlyIfUnset = false) throw(...)
	{
		return m_ext->SetArg(Name, StrArg, NumArg, OnlyIfUnset);
	}

	virtual bool SetArgStr(__in PCSTR Name, __in PCSTR Arg, __in bool OnlyIfUnset = false) throw(...)
	{
		return m_ext->SetArgStr(Name, Arg, OnlyIfUnset);
	}

	virtual bool SetArgU64(__in PCSTR Name, __in ULONG64 Arg, __in bool OnlyIfUnset = false) throw(...)
	{
		return m_ext->SetArgU64(Name, Arg, OnlyIfUnset);
	}

	virtual PCSTR GetRawArgStr(void)
	{
		return m_ext->GetRawArgStr();
	}

	virtual PSTR GetRawArgCopy(void)
	{
		return m_ext->GetRawArgCopy();
	}

	virtual PCSTR GetExpr64(__in PCSTR Str, __in bool Signed, __in ULONG64 Limit, __out PULONG64 Val) throw(...)
	{
		return m_ext->GetExpr64(Str, Signed, Limit, Val);
	}

	virtual PCSTR GetExprU64(__in PCSTR Str, __in ULONG64 Limit, __out PULONG64 Val) throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual PCSTR GetExprS64(__in PCSTR Str, __in LONG64 Limit, __out PLONG64 Val) throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void DECLSPEC_NORETURN ThrowCommandHelp(void) throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void ThrowInterrupt(void) throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void DECLSPEC_NORETURN ThrowOutOfMemory(void) throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void DECLSPEC_NORETURN ThrowContinueSearch(void) throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void DECLSPEC_NORETURN ThrowReloadExtension(void) throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void DECLSPEC_NORETURN WINAPIV ThrowInvalidArg(__in PCSTR Format, ...) throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void DECLSPEC_NORETURN WINAPIV ThrowRemote(__in HRESULT Status, __in PCSTR Format, ...) throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void DECLSPEC_NORETURN WINAPIV ThrowStatus(__in HRESULT Status, __in PCSTR Format, ...) throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

	virtual void DECLSPEC_NORETURN WINAPIV ThrowLastError(__in PCSTR Message = NULL) throw(...)
	{
		throw std::logic_error("The method or operation is not implemented.");
	}

protected:
	ExtExtension *m_ext;
};

HRESULT STDMETHODCALLTYPE CaptureOutputAImpl::QueryInterface(REFIID riid, void **ppvObject)
{
	throw std::logic_error("The method or operation is not implemented.");
}

ULONG STDMETHODCALLTYPE CaptureOutputAImpl::AddRef(void)
{
	throw std::logic_error("The method or operation is not implemented.");
}

ULONG STDMETHODCALLTYPE CaptureOutputAImpl::Release(void)
{
	throw std::logic_error("The method or operation is not implemented.");
}
